package The_first_work;

import The_first_work.Class;
import The_first_work.Group;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        // 模拟班级、小组和学生数据
        List<Class> classes = new ArrayList<>();
        classes.add(new Class(1, "一班"));
        classes.add(new Class(2, "二班"));

        List<Group> groups = new ArrayList<>();
        groups.add(new Group(1, "一组", 1));
        groups.add(new Group(2, "二组", 1));
        groups.add(new Group(3, "三组", 2));

        List<Student> students = new ArrayList<>();
        students.add(new Student(1, "小明", 1, 1));
        students.add(new Student(2, "小红", 1, 1));
        students.add(new Student(3, "小刚", 2, 1));
        students.add(new Student(4, "小丽", 2, 1));
        students.add(new Student(5, "小强", 3, 2));
        students.add(new Student(6, "小美", 3, 2));

        // 随机抽取小组
        Group randomGroup = RandomSelector.randomGroup(groups);
        System.out.println("随机抽取的小组：" + randomGroup.getName());

        // 随机抽取小组中的学生
        Student randomStudentInGroup = RandomSelector.randomStudentInGroup(students, randomGroup.getId());
        if (randomStudentInGroup!= null) {
            System.out.println("随机抽取的小组中的学生：" + randomStudentInGroup.getName());
        }

        // 随机抽取班级中的学生
        Student randomStudentInClass = RandomSelector.randomStudentInClass(students, randomGroup.getClassId());
        if (randomStudentInClass!= null) {
            System.out.println("随机抽取的班级中的学生：" + randomStudentInClass.getName());
        }
    }
}